function addStudent () {
	var name = $('#name').val();
	var sex = $('#sex').val();
	var zhuanye = $('#zhuanye').val();
	console.log(name)
	console.log(sex)
	console.log(zhuanye)
	
	$.ajax({
	                type:'POST',
	                url:'http://127.0.0.1:8000/add',
	                data:{"name":name,"sex":sex,"zhuanye":zhuanye},
	                dataType:"json",
	                success:function(data){
	                   var code = data.code;
					   if(code == "0000"){
							alert("新增学生信息成功!");
					   }else{
						   alert("新增学生信息失败,请重试!")
					   }
	                }
	            })
}

function queryStudent () {
	var queryStuNo = $('#queryStuNo').val();
	console.log(queryStuNo)
	
	$.ajax({
	                type:'POST',
	                url:'http://127.0.0.1:8000/query',
	                data:{"stuNo":queryStuNo},
	                dataType:"json",
	                success:function(data){
	                   var code = data.code;
					   if(code == "0000"){
							var stuNo = data.data.stuNo
							var name = data.data.name
							var sex = data.data.sex
							var zhuanye = data.data.zhuanye
							console.log(zhuanye)
							$('#editStuNo').val(stuNo)
							$('#editName').val(name)
							$('#editSex').val(sex)
							$('#editZhuanye').val(zhuanye)
					   }else{
						   alert("查询学生信息失败,请检查学号是否正确!")
					   }
	                }
	            })
}


function editStudent () {
	var name1 = $('#editName').val();
	var stuNo1 = $('#editStuNo').val();
	var sex1 = $('#editSex').val();
	var zhuanye1 = $('#editZhuanye').val();
	console.log(zhuanye1)
	console.log(name1)
	console.log(sex1)
	console.log(zhuanye1)
	
	$.ajax({
	                type:'POST',
	                url:'http://127.0.0.1:8000/edit',
	                data:{"name":name1,"sex":sex1,"zhuanye":zhuanye1,"stuNo":stuNo1},
	                dataType:"json",
	                success:function(data){
	                   var code = data.code;
					   if(code == "0000"){
						   $('#editStuNo').val("999")
						   $('#editName').val("name")
						   $('#editSex').val("sex")
						   $('#editZhuanye').val("zhuanye")
							alert("编辑学生信息成功!");
					   }else{
						   alert("编辑学生信息失败,请重试!")
					   }
	                }
	            })
}